import request from '../util/request'

export function getList(pageNum) {
  return request({
    url: '/ajax/post/list',
    method: 'post',
    params: {p: pageNum}
  })
}

export function getListByCategoryId(categoryId, pageNum) {
  return request({
    url: '/ajax/post/category/' + categoryId,
    method: 'post',
    params: {pageNumber: pageNum}
  })
}

export function getListByTag(tagName, pageNum) {
  return request({
    url: '/ajax/post/tag/' + tagName,
    method: 'post',
    params: {pageNumber: pageNum}
  })
}

export function getById(id) {
  return request({
    url: '/ajax/post/view/' + id,
    method: 'post'
  })
}

export function hotsN(n) {
  return request({
    url: '/ajax/post/hots/' + n,
    method: 'post'
  })
}

export function featuredsN(n) {
  return request({
    url: '/ajax/post/featureds/' + n,
    method: 'post'
  })
}

export function upVoteTo(id) {
  return request({
    url: '/ajax/post/up_vote/' + id,
    method: 'post'
  })
}

export function downVoteTo(id) {
  return request({
    url: '/ajax/post/down_vote/' + id,
    method: 'post'
  })
}
